//
//  MTHomeTopItem.m
//  美团HD
//
//  Created by kongxiaopeng on 15/6/18.
//  Copyright (c) 2015年 njsk. All rights reserved.
//

#import "MTHomeTopItem.h"
@interface MTHomeTopItem()
@property (weak, nonatomic) IBOutlet UIButton *iconButton;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *subtitleLabel;

@end
@implementation MTHomeTopItem

+ (instancetype)item{
    return [[[NSBundle mainBundle]loadNibNamed:@"MTHomeTopItem" owner:nil options:nil]firstObject];;
}

- (void)awakeFromNib{
    self.autoresizingMask = UIViewAutoresizingNone;
}

/**
 *  设置点击的监听器
 *
 *  @param target 监听器
 *  @param action 监听方法
 */
- (void)addTarget:(id)target action:(SEL)action{
    [self.iconButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
}

- (void)setIcon:(NSString *)icon highIcon:(NSString *)highIcon
{
    [self.iconButton setImage:[UIImage imageNamed:icon] forState:UIControlStateNormal];
    [self.iconButton setImage:[UIImage imageNamed:highIcon] forState:UIControlStateHighlighted];
}

- (void)setTitle:(NSString *)title
{
    self.titleLabel.text = title;
}

- (void)setSubtitle:(NSString *)subtitle
{
    self.subtitleLabel.text = subtitle;
}

@end
